# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudAsset.V1.Model.QueryAssetsRequest do
  @moduledoc """
  QueryAssets request.

  ## Attributes

  *   `jobReference` (*type:* `String.t`, *default:* `nil`) - Optional. Reference to the query job, which is from the `QueryAssetsResponse` of previous `QueryAssets` call.
  *   `outputConfig` (*type:* `GoogleApi.CloudAsset.V1.Model.QueryAssetsOutputConfig.t`, *default:* `nil`) - Optional. Destination where the query results will be saved. When this field is specified, the query results won't be saved in the [QueryAssetsResponse.query_result]. Instead [QueryAssetsResponse.output_config] will be set. Meanwhile, [QueryAssetsResponse.job_reference] will be set and can be used to check the status of the query job when passed to a following [QueryAssets] API call.
  *   `pageSize` (*type:* `integer()`, *default:* `nil`) - Optional. The maximum number of rows to return in the results. Responses are limited to 10 MB and 1000 rows. By default, the maximum row count is 1000. When the byte or row count limit is reached, the rest of the query results will be paginated. The field will be ignored when [output_config] is specified.
  *   `pageToken` (*type:* `String.t`, *default:* `nil`) - Optional. A page token received from previous `QueryAssets`. The field will be ignored when [output_config] is specified.
  *   `readTime` (*type:* `DateTime.t`, *default:* `nil`) - Optional. Queries cloud assets as they appeared at the specified point in time.
  *   `readTimeWindow` (*type:* `GoogleApi.CloudAsset.V1.Model.TimeWindow.t`, *default:* `nil`) - Optional. [start_time] is required. [start_time] must be less than [end_time] Defaults [end_time] to now if [start_time] is set and [end_time] isn't. Maximum permitted time range is 7 days.
  *   `statement` (*type:* `String.t`, *default:* `nil`) - Optional. A SQL statement that's compatible with [BigQuery SQL](https://cloud.google.com/bigquery/docs/introduction-sql).
  *   `timeout` (*type:* `String.t`, *default:* `nil`) - Optional. Specifies the maximum amount of time that the client is willing to wait for the query to complete. By default, this limit is 5 min for the first query, and 1 minute for the following queries. If the query is complete, the `done` field in the `QueryAssetsResponse` is true, otherwise false. Like BigQuery [jobs.query API](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest) The call is not guaranteed to wait for the specified timeout; it typically returns after around 200 seconds (200,000 milliseconds), even if the query is not complete. The field will be ignored when [output_config] is specified.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :jobReference => String.t() | nil,
          :outputConfig => GoogleApi.CloudAsset.V1.Model.QueryAssetsOutputConfig.t() | nil,
          :pageSize => integer() | nil,
          :pageToken => String.t() | nil,
          :readTime => DateTime.t() | nil,
          :readTimeWindow => GoogleApi.CloudAsset.V1.Model.TimeWindow.t() | nil,
          :statement => String.t() | nil,
          :timeout => String.t() | nil
        }

  field(:jobReference)
  field(:outputConfig, as: GoogleApi.CloudAsset.V1.Model.QueryAssetsOutputConfig)
  field(:pageSize)
  field(:pageToken)
  field(:readTime, as: DateTime)
  field(:readTimeWindow, as: GoogleApi.CloudAsset.V1.Model.TimeWindow)
  field(:statement)
  field(:timeout)
end

defimpl Poison.Decoder, for: GoogleApi.CloudAsset.V1.Model.QueryAssetsRequest do
  def decode(value, options) do
    GoogleApi.CloudAsset.V1.Model.QueryAssetsRequest.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudAsset.V1.Model.QueryAssetsRequest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
